/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tesis.domain;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author hugo
 */
@Entity
@Table(name = "regla_x_parametro_variable")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ReglaXParametroVariable.findAll", query = "SELECT r FROM ReglaXParametroVariable r"),
    @NamedQuery(name = "ReglaXParametroVariable.findByIdreglaxparametrovariable", query = "SELECT r FROM ReglaXParametroVariable r WHERE r.idreglaxparametrovariable = :idreglaxparametrovariable"),
    @NamedQuery(name = "ReglaXParametroVariable.findByEsentrada", query = "SELECT r FROM ReglaXParametroVariable r WHERE r.esentrada = :esentrada")})
public class ReglaXParametroVariable implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name = "regla_x_parametro_variable_idreglaxparametrovariable_seq", sequenceName = "regla_x_parametro_variable_idreglaxparametrovariable_seq")
    @GeneratedValue(generator="regla_x_parametro_variable_idreglaxparametrovariable_seq",strategy=GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idreglaxparametrovariable", nullable = false)
    private Integer idreglaxparametrovariable;
    @Basic(optional = false)
    @Column(name = "esentrada", nullable = false)
    private char esentrada;
    @JoinColumn(name = "idregla", referencedColumnName = "idregla", nullable = false)
    @ManyToOne(optional = false)
    private Regla idregla;
    @JoinColumn(name = "idparamentrovariable", referencedColumnName = "idparamentrovariable", nullable = false)
    @ManyToOne(optional = false,cascade= CascadeType.ALL)
    private ParametroVariable idparamentrovariable;

    public ReglaXParametroVariable() {
    }

    public ReglaXParametroVariable(Integer idreglaxparametrovariable) {
        this.idreglaxparametrovariable = idreglaxparametrovariable;
    }

    public ReglaXParametroVariable(Integer idreglaxparametrovariable, char esentrada) {
        this.idreglaxparametrovariable = idreglaxparametrovariable;
        this.esentrada = esentrada;
    }

    public Integer getIdreglaxparametrovariable() {
        return idreglaxparametrovariable;
    }

    public void setIdreglaxparametrovariable(Integer idreglaxparametrovariable) {
        this.idreglaxparametrovariable = idreglaxparametrovariable;
    }

    public char getEsentrada() {
        return esentrada;
    }

    public void setEsentrada(char esentrada) {
        this.esentrada = esentrada;
    }

    public Regla getIdregla() {
        return idregla;
    }

    public void setIdregla(Regla idregla) {
        this.idregla = idregla;
    }

    public ParametroVariable getIdparamentrovariable() {
        return idparamentrovariable;
    }

    public void setIdparamentrovariable(ParametroVariable idparamentrovariable) {
        this.idparamentrovariable = idparamentrovariable;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idreglaxparametrovariable != null ? idreglaxparametrovariable.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReglaXParametroVariable)) {
            return false;
        }
        ReglaXParametroVariable other = (ReglaXParametroVariable) object;
        if ((this.idreglaxparametrovariable == null && other.idreglaxparametrovariable != null) || (this.idreglaxparametrovariable != null && !this.idreglaxparametrovariable.equals(other.idreglaxparametrovariable))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.ReglaXParametroVariable[ idreglaxparametrovariable=" + idreglaxparametrovariable + " ]";
    }
    
}
